<template>
	<empDetail :temp_data="temp_data" :group_data="group_data" v-if="group_data.type=='人员'"></empDetail>
	<proDetail :temp_data="temp_data" :group_data="group_data" v-else></proDetail>
</template>

<script>
import {getAPItokenRes} from '@/utils/api'
import empDetail from './empDetail'
import proDetail from './proDetail'
export default {
	components: {
		empDetail,
		proDetail
	},
	data () {
		return {
			temp_id: this.$route.query.id,
			temp_data: {},
			group_data: {},
		}
	},
	methods: {
		getTemplate () {
			const promise = getAPItokenRes(API.sysTemp+this.temp_id+'/',this.token)
			promise.then((res)=>{
				if (res.status == 200) {
					this.temp_data = res.data
					this.group_data = res.data.group
				}
			})
		},
		getFields () {
			const promise = getAPItokenRes(API.sysTemp+this.temp_id+'/',this.token)
		}
	},
	mounted () {
		this.token = this.$store.state.user.token
		this.getTemplate()
	}
}
</script>
<style scoped>
span {
	color: #7a838f;
}
</style>